﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ExitManager : MonoBehaviour
{
    uint exitCount = 0;
    void Update()
    {
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            exitCount++;
            if (!IsInvoking("disableDoubleClick"))
                Invoke("disableDoubleClick", 0.5f);
        }
        if (exitCount == 2)
        {
            CancelInvoke("disableDoubleClick");
            Application.Quit();
        }
    }

    void disableDoubleClick()
    {
        exitCount = 0;
    }
}
